package net.vanchu.mortgagecalculator.mortgage.data.monthRepayment;

import net.vanchu.mortgagecalculator.mortgage.data.PrincipalAndInterest;

/**
 * Created by granton on 2016/12/13.
 */
public class MixMonthRepay extends MonthRepay {

    private PrincipalAndInterest commercialPart;

    private PrincipalAndInterest providentFundPart;

    public MixMonthRepay(int index, double remainPrincipal,
                         PrincipalAndInterest commercialPart,
                         PrincipalAndInterest providentFundPart) {
        super(index, remainPrincipal);
        this.commercialPart = commercialPart;
        this.providentFundPart = providentFundPart;
    }

    public PrincipalAndInterest getCommercialPart() {
        return commercialPart;
    }

    public PrincipalAndInterest getProvidentFundPart() {
        return providentFundPart;
    }

    @Override
    public double getRemainPrincipal() {
        return super.getRemainPrincipal();
    }

    @Override
    public double getTotalPrincipal() {
        return commercialPart.getPrincipal() + providentFundPart.getPrincipal();
    }

    @Override
    public double getTotalInterest() {
        return commercialPart.getInterest() + providentFundPart.getInterest();
    }

    @Override
    public double getTotalRepayNumber() {
        return getTotalPrincipal() + getTotalInterest();
    }
}